<template>
  <!-- 首页分类都能用的盒子 -->
  <navigator
    :url="`/pages/FenLeiList/index?id=${item_id}&name=${item_name}`"
    class="item"
  >
    <slot name="pic">图片</slot>

    <div class="title">
      <slot name="name">默认标题</slot>
    </div>
  </navigator>
</template>

<script setup>
// 接收父组件传来的数据（每个图片的id）
const props = defineProps({
  item_id: String,
  item_name: String,
});
</script>

<style scoped lang="scss">
.item {
  position: relative;
  width: 220rpx;
  height: 340rpx;
  overflow: hidden;
  border-radius: 10rpx;
  // background-color: pink;

  .title {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 70rpx;
    text-align: center;
    line-height: 70rpx;
    color: white;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20rpx);
  }
}
</style>